const state = {
  count: -1
}

const actions = {
  increment({ commit }, payload) {
    commit('INCREMENT', payload)
  },
  decrement({ commit }, payload) {
    commit('DECREMENT', payload)
  }
}

const getters = {
  count: state => state.count
}

const mutations = {
  'INCREMENT': (state, payload) => {
    console.log('payload', payload);
    state.count += payload
  },
  'DECREMENT': (state, payload) => {
    console.log('payload', payload);
    state.count -= payload
  }

}

export default {
  state, actions, getters, mutations
}
